{layout name="./base/base_back"}

		<link rel="stylesheet" type="text/css" href="/front/css/common.css"/>
		<link rel="stylesheet" type="text/css" href="/front/css/publishWish.css"/>
		<!-- <link rel="stylesheet" type="text/css" href="./css/jquery-ui.css"/> -->
		<link rel="stylesheet" type="text/css" href="/front/css/caravanInfo.css">
		<link rel="stylesheet" type="text/css" href="/front/css/weifeng.css"/>
		<!-- 上传图片 -->
		<link rel="stylesheet" type="text/css" href="/front/diyUpload/css/webuploader.css">
		<link rel="stylesheet" type="text/css" href="/front/diyUpload/css/diyUpload.css">
		<style>
			*{ margin:0; padding:0;}
			#box{margin:5px auto;width:875px; min-height:400px; background:#FF9}
			#demo{margin:5px auto;width:875px; min-height:800px; background:#CF9}
		</style>
		<!--我的房车信息开始-->
		<div id="caravan-info-box">
			<div id="caravan-info">
				{include file="./navleft"}
				<div class="caravan-info-right">
					<div class="caravan-info-tit">我的房车</div>
					<div class="caravan-info-perfect-prompt">尊敬的双辉会员，请完善房车信息，其他双辉会员能更详细的了解您的房车信息，有助于完成互换，提高您的房车交换率。</div>
					<form id="form1" action="/caravaninfo/updateinfoform" method="post" enctype="multipart/form-data">
						<!--房车基本信息开始-->
						<div class="caravan-info-form">
							
							<h3>房车基本信息 <span>(※为必填信息)
							{if $user_type==$tg}
							已审核通过，可继续完善其他信息
							{/if}
							</span></h3>
							<div class="form-group-input">
								<label for="" class="form-label">房车名称：</label>
								<input type="text" name="name" value="{$list.name}" placeholder="请输入您的房车名称"/>
							</div>
							{if $user_type!=$tg}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>房车品牌：</label>
								<select name="car_brands_id">
								{foreach $brands as $k => $type}
								{if $list.car_brands_id==$k}
									<option value={$k} selected='true'>{$type}</option>
								{else}
		                       		<option value={$k} >{$type}</option>
		                       	{/if}
		                       	{/foreach}
								</select>
							</div>
							{else}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>房车品牌：</label>
							{php} echo model('CaravanInfos')->getBrands($list['car_brands_id']);{/php}
							</div>
							{/if}
							{if $user_type!=$tg}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>车型：</label>
								<select name="car_cates_id">
								{foreach $cates as $k => $type}
								{if $list.car_cates_id==$k}
									<option value={$k} selected='true'>{$type}</option>
								{else}
		                       		<option value={$k} >{$type}</option>
		                       	{/if}
		                       	{/foreach}
								</select>
							</div>
							{else}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>车型：</label>
								{php} echo model('CaravanInfos')->getCates($list['car_cates_id']);{/php}
							</div>
							{/if}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>排档：</label>
								<select name="speed">
								{foreach $ziduan3 as $k => $type}
								{if $list.speed==$k}
									<option value={$k} selected='true'>{$type}</option>
								{else}
		                       		<option value={$k} >{$type}</option>
		                       	{/if}
		                       	{/foreach}
								</select>
							</div>
							{if $user_type!=$tg}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>准驾类型：</label>
								<select name="driver_type">
								{foreach $dr_type as $k => $type}
								{if $list.driver_type==$k}
									<option value={$k} selected='true'>{$type}</option>
								{else}
		                       		<option value={$k} >{$type}</option>
		                       	{/if}
		                       	{/foreach}
								</select>
							</div>
							{else}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>准驾类型：</label>
								{php} echo model('CaravanInfos')->getDrtypes($list['driver_type']);{/php}
							</div>
							{/if}
							{if $user_type!=$tg}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>交车日期：<span id="registrationerror" style="color: red;"></span></label>
								<input type="text" id="registration" name="registration" value="{$list.registration}"  placeholder="请输入您的注册日期" />
							</div>
							{else}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>交车日期：</label>
								{$list.registration}
							</div>
							{/if}
							{if $user_type!=$tg}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>国别：</label>
								<select name="car_countries_id">
								{foreach $countries as $k => $type}
								{if $list.car_countries_id==$k}
									<option value={$k} selected='true'>{$type}</option>
								{else}
		                       		<option value={$k} >{$type}</option>
		                       	{/if}
		                       	{/foreach}
								</select>
							</div>
							{else}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>国别：</label>
							{php} echo model('CaravanInfos')->getCountries($list['car_countries_id']);{/php}	
							</div>
							{/if}
							{if $user_type!=$tg}
							<div class="form-group-input" id="addressD">
		                    	<label for="" class="form-label"><span>※</span>房车服务机构</label>
								<select name="addressCountry" class="addressCountry" data-first-title="选择国家" data-url="/caravaninfo/country" data-required="true"  style="width:100px;" ></select>
								<select name="addressProvince" class="addressProvince" data-first-title="选择省" data-url="/caravaninfo/province" data-required="true" style="width:100px;"></select>
							    <select name="addressCity" id="addressCity" class="addressCity" data-first-title="选择城市"  data-url="/caravaninfo/city" data-required="true" style="width:100px;"></select>
								<select name="addressCamp" class="addressCamp" data-first-title="选择房车服务机构" data-url="/caravaninfo/camp" data-required="true" style="width:100px;">
								</select>
		                  	</div>
		                  	{else}
		                  	<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>房车服务机构：</label>
								{php} echo model('camps')->where('id',$list['services'])->value('name');{/php}
							</div>
		                  	{/if}
							<div class="form-group-input">
								<label for="" class="form-label"></label>
								<input type="text" name="services_other" placeholder="填写其他房车服务机构的地址">
							</div>
							<div class="form-group-input">
								<label for="" class="form-label">泊位编号：</label>
								<input type="text" name="park_num" value="{$list.park_num}" placeholder="请输入泊位编号"/>
							</div>
						</div>
						<!--房车基本信息结束-->
						<!--房车室内信息开始-->
						<div class="caravan-info-form">
							<h3>房车室内信息</h3>
							{if $user_type!=$tg}
							<!-- 房车尺寸去除 -->
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>可住几人：<span id="people_numerror" style="color: red;"></span></label>
								<input type="text" name="people_num" value="{$list.people_num}"  placeholder="可住几人"/>
							</div>
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>单人床数量：<span id="single_bed_numerror" style="color: red;"></span></label>
								<input type="text" name="single_bed_num" value="{$list.single_bed_num}" placeholder="单人床数量"/>
							</div>
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>双人床数量：<span id="double_bed_numerror" style="color: red;"></span></label>
								<input type="text" name="double_bed_num"  value="{$list.double_bed_num}" placeholder="双人床数量"/>
							</div>
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>沙发乘坐人数：<span id="sofe_numerror" style="color: red;"></span></label>
								<input type="text" name="sofe_num" value="{$list.sofe_num}" placeholder="沙发乘坐人数"/>
							</div>
							{else}
							<!-- 房车尺寸去除 -->
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>可住几人：</span></label>
								{$list.people_num}
							</div>
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>单人床数量：</label>
								{$list.single_bed_num}
							</div>
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>双人床数量：</label>
								{$list.double_bed_num}
							</div>
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>沙发乘坐人数：</label>
								{$list.sofe_num}
							</div>
							{/if}

							{if $user_type!=$tg}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>厨房：</label>
								{if $list.kitchen==1}
								<label for="kitchen-you" class="form-label-radio">有 <input type="radio" id="kitchen-you" name="kitchen" value="1" checked="true" class="form-radio"/></label>
								<label for="kitchen-wu" class="form-label-radio">无<input type="radio" id="kitchen-wu" name="kitchen" value="2" class="form-radio"/></label>
								{elseif $list.kitchen==$tg}
								<label for="kitchen-you" class="form-label-radio">有 <input type="radio" id="kitchen-you" name="kitchen" value="1" class="form-radio"/></label>
								<label for="kitchen-wu" class="form-label-radio">无<input type="radio" id="kitchen-wu" name="kitchen" checked="true" value="2" class="form-radio"/></label>
								{else}
								<label for="kitchen-you" class="form-label-radio">有 <input type="radio" id="kitchen-you" name="kitchen" value="1" class="form-radio"/></label>
								<label for="kitchen-wu" class="form-label-radio">无<input type="radio" id="kitchen-wu" name="kitchen" checked="true" value="2" class="form-radio"/></label>
								{/if}
							</div>
							{else}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>厨房：</label>
								<label for="kitchen-you" class="form-label-radio"> 
								{php} echo model('CaravanInfos')->getRadioName($list['kitchen']);{/php}
								</label>
							</div>
							{/if}
							{if $user_type!=$tg}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>卫生间：</label>
								{if $list.bathroom==1}
								<label for="alertor-you" class="form-label-radio">有 <input type="radio" id="alertor-you" name="bathroom" value="1" checked="true" class="form-radio"/></label>
								<label for="alertor-wu" class="form-label-radio">无<input type="radio" id="alertor-wu" name="bathroom" value="2" class="form-radio"/></label>
								{elseif $list.bathroom==$tg}
								<label for="alertor-you" class="form-label-radio">有 <input type="radio" id="alertor-you" name="bathroom" value="1"  class="form-radio"/></label>
								<label for="alertor-wu" class="form-label-radio">无<input type="radio" id="alertor-wu" name="bathroom" value="2" checked="true" class="form-radio"/></label>
								{else}
								<label for="alertor-you" class="form-label-radio">有 <input type="radio" id="alertor-you" name="bathroom" value="1"  class="form-radio"/></label>
								<label for="alertor-wu" class="form-label-radio">无<input type="radio" id="alertor-wu" name="bathroom" value="2" checked="true" class="form-radio"/></label>
								{/if}
							</div>
							{else}
							<div class="form-group-input">
								<label for="" class="form-label"><span>※</span>卫生间：</label>
								<label for="bathroom-you" class="form-label-radio"> 
								{php} echo model('CaravanInfos')->getRadioName($list['bathroom']);{/php}
								</label>
							</div>
							{/if}
							{foreach $ziduan1 as $key=>$value}
							<div class="form-group-input">
								<label for="" class="form-label">{$key|lang}：</label>
								{foreach $value as $k=>$v}
								<label for="extinguisher-wu" class="form-label-radio">
								{if $list[$key]==$k}
								<input type="radio" id="{$key.$k}" name="{$key}" checked="true" value="{$k}" class="form-radio"/>{$v|lang}</label>
								{else}
								<input type="radio" id="{$key.$k}" name="{$key}" value="{$k}" class="form-radio"/>{$v|lang}</label>
								{/if}
								{/foreach} 
							</div>
							{/foreach}
						</div>
						<!--房车室内信息结束-->
						<!--安全设施开始-->
						<div class="caravan-info-form">
							<h3>安全设施</h3>
							{foreach $ziduan2 as $key=>$value}
							<div class="form-group-input">
								<label for="" class="form-label">{$key|lang}：</label>
								{foreach $value as $k=>$v}
								<label for="extinguisher-wu" class="form-label-radio">
								{if $list[$key]==$k}
								<input type="radio" id="{$key.$k}" name="{$key}" checked="true" value="{$k}" class="form-radio"/>{$v|lang}
								{else}
								<input type="radio" id="{$key.$k}" name="{$key}"  value="{$k}" class="form-radio"/>{$v|lang}	
								{/if}
								</label>
								{/foreach} 
							</div>
							{/foreach}
							<!--封面图片-->
							<div class="caravan-info-form">
								<h3>封面图片（请按规范上传1张 图片大小2MB）</h3><br>
								<div style="margin:5px auto;width:875px; min-height:200px;">
									<div id="caravancover">
									    <!--用来存放item-->
									    <div id="fileList" class="uploader-list"></div>
									    <div id="filePicker">选择图片</div>
									</div>
									{if !empty($list.caravancover)}
									<img src="{$list.caravancover['0']}" width="800px">
									{/if}
								</div>
							</div>
							<!--内容图片-->
							<div class="caravan-info-form">
								<h3>内容图片(请上传5张，包括房车内、外图片和内饰图片 单张图片大小2MB)</h3>
								<div style="margin:5px auto;width:875px; min-height:200px;">
									<div id="caravanphoto" ></div>
									{if !empty($list.piccaravan['0'])}
									<img src="{$list.piccaravan['0']}" width="400px">
									{/if}
									{if !empty($list.piccaravan['1'])}
									<img src="{$list.piccaravan['1']}" width="400px">
									{/if}
									{if !empty($list.piccaravan['2'])}
									<img src="{$list.piccaravan['2']}" width="400px">
									{/if}
									{if !empty($list.piccaravan['3'])}
									<img src="{$list.piccaravan['3']}" width="400px">
									{/if}
									{if !empty($list.piccaravan['4'])}
									<img src="{$list.piccaravan['4']}" width="400px">
									{/if}
								</div>
								
							</div>
							<div class="form-group-input form-button">
								<button type="submit">
								{if $user_type!=$tg}
								提交审核
								{else/}
								继续完善
								{/if}
								</button>
							</div>
						</div>
					</form>
						<!--房车室内信息结束-->
				</div>
			</div>
		</div>
		<!--我的房车信息结束-->
<script src="/front/js/jquery.js"></script>
<!-- 世界城市地区联动 -->
<script src="/js/jquery.cxselect.js"></script>
<script>
	$('#addressD').cxSelect({
	selects: ['addressCountry','addressProvince', 'addressCity','addressCamp'],
	jsonName: 'area_name',
	jsonValue: 'area_code'	}, function(api) {
	  cxSelectApi = api;
	});
</script>
<script type="text/javascript" src="/front/diyUpload/js/webuploader.js"></script>
<script type="text/javascript" src="/front/diyUpload/js/diyUpload.js"></script>
<script src="/front/js/weifeng.js" type="text/javascript"></script>
<script type="text/javascript">
	$(function(){
		/*
		* 服务器地址,成功返回,失败返回参数格式依照jquery.ajax习惯;
		* 其他参数同WebUploader
		*/
		$('#caravancover').diyUpload1({
			url:'/caravaninfo/uploadimg',
			success:function( data ) {
				$('#form1').append('<input type="hidden" name="caravancover[]" value="'+data.url+'" />'); 
			},
			error:function( err ) {
				// console.info( err );	
			},
			buttonText : '选择房车封面',
			fileNumLimit:1,
			fileSingleSizeLimit:2*1024 * 1024,
			thumb:{
				width: 800,
    			height: 200,
			}
		});
		$('#caravanphoto').diyUpload({
			url:'/caravaninfo/uploadimg',
			success:function( data ) {
				$('#form1').append('<input type="hidden" name="caravanphoto[]" value="'+data.url+'" />'); 
			},
			error:function( err ) {
				console.info( err );	
			},
			buttonText : '选择5张房车图片',
			chunked:true,
			// 分片大小
			chunkSize:512 * 1024,
			//最大上传的文件数量, 总文件大小,单个文件大小(单位字节);
			fileNumLimit:5,
			fileSizeLimit:10*1024 * 1024,
			fileSingleSizeLimit:2*1024 * 1024,
			accept: {},
			thumb:{
				width: 388,
    			height: 200,
			}
		});
	}); 
</script>
<script type="text/javascript">
	$(function(){
		//注册日期
		$("input[name='registration']").blur(function(){
			var registration = $('input[name="registration"]').val();
			//不能为空
			if(!$.trim(registration)) {
				$("input[name='registration']").css({border: "1px solid red"});
				$("#registrationerror").html("");
				$("#registration").readOnly = false;
				return false;
			}else{
				$("input[name='registration']").css({border: "1px solid green"});
				$("#registrationerror").html("");
				//$("#registrationerror").readOnly = false;
			}
			
		})
		//可住几人
		$("input[name='people_num']").blur(function(){
			var people_num = $('input[name="people_num"]').val();
			//不能为空
			if(!$.trim(people_num)) {
				$("input[name='people_num']").css({border: "1px solid red"});
				$("#people_numerror").html("");
				return false;
			}else{
				$("input[name='people_num']").css({border: "1px solid green"});
				$("#people_numerror").html("");
			}
			
		})
		//房车尺寸
		$("input[name='size']").blur(function(){
			var size = $('input[name="size"]').val();
			//不能为空
			if(!$.trim(size)) {
				$("input[name='size']").css({border: "1px solid red"});
				$("#sizeerror").html("");
				return false;
			}else{
				$("input[name='size']").css({border: "1px solid green"});
				$("#sizeerror").html("");
			}
			
		})
		//单人床数量
		$("input[name='single_bed_num']").blur(function(){
			var single_bed_num = $('input[name="single_bed_num"]').val();
			//不能为空
			if(!$.trim(single_bed_num)) {
				$("input[name='single_bed_num']").css({border: "1px solid red"});
				$("#single_bed_numerror").html("");
				return false;
			}else{
				$("input[name='single_bed_num']").css({border: "1px solid green"});
				$("#single_bed_numerror").html("");
			}
			
		})
		//双人床数量
		$("input[name='double_bed_num']").blur(function(){
			var double_bed_num = $('input[name="double_bed_num"]').val();
			//不能为空
			if(!$.trim(double_bed_num)) {
				$("input[name='double_bed_num']").css({border: "1px solid red"});
				$("#double_bed_numerror").html("");
				return false;
			}else{
				$("input[name='double_bed_num']").css({border: "1px solid green"});
				$("#double_bed_numerror").html("");
			}
			
		})
		//沙发乘坐人数
		$("input[name='sofe_num']").blur(function(){
			var sofe_num = $('input[name="sofe_num"]').val();
			//不能为空
			if(!$.trim(sofe_num)) {
				$("input[name='sofe_num']").css({border: "1px solid red"});
				$("#sofe_numerror").html("");
				return false;
			}else{
				$("input[name='sofe_num']").css({border: "1px solid green"});
				$("#sofe_numerror").html("");
			}
			
		})

	})
</script>